package net.zjitc.common.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016092000557035";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQCqdGq/e5cUigGagM4U2ipB+2xtwGIqIJTYG+Hkf0eZ47XsdlZiqEnVKbn5rfGAOMybhDwlnVv0gWK0h2PdBRztJ6j9VrzV/ljIzppW/L1oZA2tFwJWOW1RbArNgcdK0e4t3heZ3pI47F7GirymLPEFnpPP1nVIxTTSyvwh3wfjkl4lsn+xMUNAG9BOp/yii68onHC1K4Qc/UC16tWLfEtDU5Dio2SZRJMQP06iXBa6zLGPLIWu0qata5nXS5Cm/KHpbviAeJPKbzyrySgjw3s5rweetYrYnUph4JYi3ylMTLUXTNuBJ2gQSQmNmG7Ghri3+XNOdGFizpItj7A0xyg/AgMBAAECggEBAIEjD9igFpbN82cNXJP5sPgqNjxz+yr1Yi7T+PC26RUSqjpKcSnvW3huU2JwwL0mywSrSzIoJIl6GMCyrhq9i+u0F1hPhWMOfk8sD0wF0K2s15uiCfgvK736/7gwMT9jCnKfhvvg3qDXmvoKE+BFvhhGyq80R8jo9xsYA6rZoM1sUUuuei/L9kLRK2agQ44gxR/Ihr2fh82bls1uHF4h+hXF254xMQvNPtj0wCEaNmuFE6OzBQPkYFo0cJoEK75ZNdq1otpI5W9WlmrSKXXPaIKxSk9hgJwn3FZC9FIRIg/wcxCJ02xWbUrU5TJuhSCplEGWqwmH1VGvkrf75R+1nYkCgYEA54GmkRVjgDmxyD0mEbAxu/U8rP8LLYsv9f1be1a2F8SLG/8yZf+GrOeExi/G+t7MVbuvJLwh0K1WFU9pI/Gf4iqeIBv/7F5YpaHpfWUJ3AQbyb9j8MSNxmXEAhB4IApk5d+VjpwfpuqixzStl1sTWdjmB64HPCfA/PG4JG+mkOsCgYEAvH0uk2nI5O6WDV6rKNpFbtqZnf1MVlDxVdT9lADnOA9BDu2yl8ualmZqvl6jJ/zWW3DKWUli/qWrcc1JBl/2weFfta13R16+kshjwGvCwGM2O5hXpl87hPa80tNH0ORNEWEdMCTeC2BisJX53Pd1ONW1M6mcHgUZ8eZDzkOB0P0CgYEA2MBa45vS/UsHWSNncUg2SHTjylVAcfPPg9Eixef5tWcfl6bn2PfVcC2T8rro4hmX1u1SnmJGhsrDvlALcMvZljewtP+CLhxngyyFIBJpmMV//vRi7hoZY5gEXKpuzhDtRwx/SnaCbBVjMn/vx7ZN9+FL/gTCYWAXILxwXCztFuECgYEAjFRGkMl5H7fhTyLkGw4mE1n8dHtYkgrBIj3obIAfpMT2kr607/5NoRuu7PxYTDUZAgr/G2pfoWaGNbu4Wl6nv8CjGQeEfkYza+R1H5Ua8VDr14Kb/ul3zo5EFlHmbccK+Z1rtaQ9DAs+bmm6FKDHTQEOXuAvssnpfwcIBFCOHaECgYEAk+nAmkAyVAb4YEVzBEOvfC66uua0vJdAA+a1MPXQxMv5X6icuZLp4LWZTReDMsWhHSSya3rMo5Gkux4icHPVe1U8X5vAv3UTMQccJJ7O83MjzwLS9e2ItzfkWqEKXSIR2E8Q++oHNbH1MpDS9wgh48SqfdCk0D2CJ0jECEGnhV8=";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8WkpJ/0OIW6tmX256c1w4Q6h/RhnOvQTjsMR/c4kEcL0O1EzMLW+t3hrsDG7uca0MNJn/pzBS6TWrevi9dsg1GqU5o7UVaoJMnNRDttl1TncSAc/+Juq8ii0Dp+l8py38o9O+AYQPnsyaDB10tNSZM37l+LL2feqwSrpLw7cZUkAIk81EkfNV6b7qyNKP/2cBWuK7ZkguBYyei/IZzkZVW0oGDfqke0sM0RLViN5w2IbAS88tv1wqHAZKmWuEVSRXTcBOYKtNDxg/lXBrsQIZvmuJ3xD52u9r2SXrgJMsEW+cmSR30ywxvCpNRrQleei67KlOI71Yr2lblnIKNLyvwIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/shop/notify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/order/payReturn.do";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关  https://openapi.alipaydev.com/gateway.do
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
